<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
		<title>学生端考核列表</title>
		<link rel="stylesheet" type="text/css" href="../../css/api.css" />
		<link rel="stylesheet" href="../../css/mui.min.css"/>
		<link rel="stylesheet" href="../../css/base.css"/>
		<link rel="stylesheet" href="../../css/CFNetPP_Base.css">
		<style type="text/css">
			.mui-table-view {
				margin-left: 0;
			}
			.mui-table-view-cell > a:not(.mui-btn) {
				padding: 10px;
			}
			.mui-table-view-cell > a:not(.mui-btn) .course-img {
				display: block;
				width: 136px;
				max-width: 136px;
				height: 84px;
				background-image: url(../../image/course_placehoder.png);
				background-size: 136px 84px;
			}
			.mui-table-view-cell .top-content {
				height: 40px;
			}
			.mui-table-view-cell .bottom-content {
				/*padding-top: 16px;*/
				height: 44px;
			}
			.mui-table-view-cell>a:not(.mui-btn) .course_title {
		    overflow: hidden;
		    text-overflow: ellipsis;
		    white-space: pre-wrap;
		    display: -webkit-box;
		    -webkit-line-clamp: 2;
		    -webkit-box-orient: vertical;
		    font-size: 14px;
		    color: #222;
		    line-height: 20px;
           }
			.mui-table-view-cell > a:not(.mui-btn) .subtitle {
				color: #999;
				font-size: 12px;
				overflow: hidden;
				white-space: normal;
				text-overflow: ellipsis;
				line-height: 14px;
			}
			
			.subtitle-red {
				color: #e10d20;
				font-size: 12px;
				margin: 0;
			}
			.cell-btn {
				font-size: 12px;
				font-weight: 400;
				line-height: 1.2;
				padding: 4px 6px;
				border-color: #1da4e8;
				background-color: #1da4e8;
				color: white;
				width: 70px;
			}
			.cell-btn:enabled:active {
				background-color: #2db4f8;
			}
			.bottom-content .cell-content-left {
				padding-right: 68px;
				float: left;
			}
			.bottom-content .cell-content-right {
				padding-top: 10px;
				width: 68px;
				height: 42px;
				float: right;
				position: absolute;
				right: 10px;
				top: 50px;
			}
			.button-super-div {
				padding: 2px 0;
			}
			.course-status-tag {
				position: absolute;
				bottom: 10px;
				left: 10px;
				font-size: 12px;
				color: white;
				padding: 2px 4px;
				line-height: 1em;
				width: 136px;
				background-color: rgba(0,0,0,0.5);
				text-align: center;
			}
			.course-status-tag-red {
				background-color: #EC1A2B;
			}
			.course-status-tag-green {
				background-color: #1DBF53;
			}
			.tag-img {
				width: 12px;
				height: 12px;
				margin-right: 4px;
			}
			.cell-btn {
				margin-right: 10px;
			}
			.info-span {
				margin-left: 2px;
			}
			.mui-table-view-cell .top-content {
               height: 40px;
              }
			.mui-table-view .mui-media-object.mui-pull-left {
				margin-right: 12px;
			}
			.top-p {
				margin-top: 10px;
			}
			.bottom-p {
				margin-top: 6px;
			}
			.top-blank-div {
				height: 8px;
				padding: 4px;
				background-color: #f3f5f7;
			}
			.plan-name-title {
				font-size: 14px;
				color: #222;
				line-height: 14px;
				height: 14px;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 1;
				-webkit-box-orient: vertical;
			}
			.right-content {
				width: 40px;
				float: right;
				margin-top: -12px;
			}
			.left-content {
				margin-right: 40px;
			}
			.cell-right-btn {
				width: 40px;
				height: 24px;
			}
			.mui-table-view-cell {
				padding: 10px;
			}
			.mui-table-view-cell > a:not(.mui-btn) {
				padding: 10px;
				margin: -10px;
			}
			.course-type-tag {
				font-size: 12px;
				width: 40px;
				height: 16px;
				text-align: center;
				line-height: 16px;
				color: white;
				background-color: #DB112F;
				position: absolute;
				left: 106px;
				top: 10px;
			}
			.plan-arrow {
				position: absolute;
				right: 10px;
				top: 9px;
				height: 16px;
			}
		</style>
	</head>
	<body>
	  <div class="content-div">
		<ul id="list_day" class="mui-table-view" >
		<!--	<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
				<p class="course-status-tag">已结束</p> 
					<p class="course-type-tag">授课</p>
					<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png"/>
				<div class="mui-media-body top-content">
					<p class="course_title">第三轮轮岗岗位名称考核111111111111111111111</p>
				</div>
				<div class="mui-media-body top_10">
					<p class="mui-ellipsis subtitle">
						<span class="left-span">时间 :</span>
						<span class="info-span">2018-4-17~2018-4-23</span>
					</p>
				</div>
				<div class="mui-media-body top_5">
					<p class="mui-ellipsis subtitle">
						<span class="left-span">时长 :</span>
						<span class="info-span">60分钟</span>
					</p>
				</div> 
				 </a>
			</li>-->
	<!--			<li class="mui-table-view-cell mui-media">
				<a href="javascript:;">
					<p class="course-status-tag">已结束</p> 
					<p class="course-type-tag">授课</p>
					<img class="mui-media-object mui-pull-left course-img" src="../../image/list-default.png"/>
					<div class="mui-media-body top-content">
						<p class="course_title">课程名称1111111111111111111111111</p>
					</div>
					<div class="mui-media-body bottom-content">
						<div class="top-p">
							<p class="mui-ellipsis subtitle">
								<span class="left-span">时间 :</span>
						        <span class="info-span">2018-4-17~2018-4-23</span>
							</p>
						</div>
						<div class="bottom-p">
							<div class="left-content">
								<p class="mui-ellipsis subtitle">
									<span class="left-span">时长 :</span>
						            <span class="info-span">60分钟</span>
								</p>
							</div>
						</div>
					</div>
				</a>
			</li>-->
			
		</ul>
		</div>
		<div class="noSign" hidden="hidden" id="noData">
			<img src="../../image/icon_img.png" width="60%">
			<p class="font16 top_15 base_dark_grey" >
				暂无数据
			</p>
		</div>
		<div class="loadFailure" hidden="hidden" id="noNet">
			<img src="../../image/icon_img01.png" width="60%">
			<p class="" >
				数据加载失败
			</p>
			<p>
				请检查您的网络
			</p>
			<button type="button" class="mui-btn mui-btn-outlined" onclick="refreshData()">
				重新加载
			</button>
		</div>
	</body>
	<script type="text/javascript" src="../../script/api.js"></script>
	<script type="text/javascript" src="../../script/MD5.js"></script>
	<script src="../../script/jquery.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../../script/requestTool.js"></script>
	<script type="text/javascript" src="../../script/timeStampTool.js"></script>
	<script src="../../script/common.js"></script>
	<script type="text/javascript">
		var page = 1;
		var rows = 10;
		var refreshCount = 0;
		var sid = '';
		var firstLoad = true;
		apiready = function() {
			loadNewData();
			setRefreshHeader();
			setPullUpRefresh();
			receNotifi();
			sendBuriedNotifi('0', '实习考核列表', '221');
		};
		
		function sendBuriedNotifi(busionessid, pagetype, pagetypeid) {
			var userinfo = {
				uid : $api.getStorage('cfnetppuid'),
				jid : $api.getStorage('cfnetppjid'),
				uname : $api.getStorage('cfnetppusername'),
			}
			var data = {
				busionessid : busionessid,
				pagetype : pagetype,
				pagetypeid : pagetypeid,
				sourceurl : api.pageParam.sourceurl,
				sourcetitle : api.pageParam.sourcetitle,
				accesspageurl : window.location.pathname,
				accesspagetitle : document.title,
				userinfo : userinfo
			}
			SendBehaviorTrajectoriesNotifi_Study(data);
		}
		function receNotifi() {
			api.addEventListener({
				name : 'RefreshPracticeExamList'
			}, function(ret, err) {
				refreshData();
			});
		}

		//下拉刷新
		function setRefreshHeader() {
			api.setRefreshHeaderInfo({
				visible : true,
				bgColor : '#ccc',
				textColor : '#fff',
				textDown : '下拉刷新...',
				textUp : '松开刷新...',
				showTime : true
			}, function(ret, err) {
				loadNewData();
			});
		}

		// 上拉加载
		function setPullUpRefresh() {
			api.addEventListener({
				name : 'scrolltobottom'
			}, function(ret, err) {
				if (refreshCount >= rows) {
					loadMoreData();
				}
			});
		}

		function loadNewData() {
			page = 1;
			loadData();
		}

		function loadMoreData() {
			page++;
			loadData();
		}

		//获取数据
		function loadData() {
			if (firstLoad == true) {
				showProgress();
				firstLoad = false;
			}
			var params = {
				jid : $api.getStorage('cfnetppjid'),
				uid : $api.getStorage('cfnetppuid'),
//              uid:52721,
//              jid:337,
				page : page,
				rows : rows,
				
			};
			cfnetppPOST(url_getExamStudentList, params, true, function(data, status) {
			
				api.hideProgress();
				api.refreshHeaderLoadDone();
				if (status == 'success') {
					if (data.code == 200) {
						var listdata = data.data;
						if (listdata != '' && listdata.constructor == Array && listdata.length > 0) {
							$('#noData').hide();
							$('#noNet').hide();
							$('#mian').show();
							refreshCount = listdata.length;
							writelist(listdata, refreshCount);
						} else {
							if (page == 1) {
								$('#noData').show();
								$('#noNet').hide();
							}
						}
					} else if (data.code = 108) {
						if (page == 1) {
							$('#noData').show();
							$('#noNet').hide();
							$('#stulist').html('');
						}
					} else {
						if (page == 1) {
							$('#noData').show();
							$('#noNet').hide();
							$('#stulist').html('');
						}
					}
				} else {
					if (page > 1) {
						page--;
						refreshCount = rows;
						api.toast({
							msg : '网络异常'
						});
					} else {
						$('#noData').hide();
						$('#noNet').show();
						$('#stulist').html('');
					}
				}
			});
		}

		function refreshData() {
			firstLoad = true;
			loadNewData();
		}
         /*assessment_status 1 考核开始  0 未开始  -1 结束
         exam_status 1通过 0 未通过 -1 未考试
         exam_instime 交卷时间
         fenshu 考试得分*/
		function writelist(listdata, len) {
		
			var htmlsdata = '';
			var timeStr="";
			var tagStr="";
			var typeStr="";
			var two_spanStr="";
			for (var i = 0; i < len; i++) {
				var data = listdata[i];

				var DataArr = JSON.stringify(data).replace(/"/g, '&quot;');
				timeStr=getLocalTime(data.starttime)+'~'+getLocalTime(data.endtime);
				if(data.assessment_status==0){//未开始
				   tagStr='<p class="course-type-tag">'+'未开始'+'</p>';
				   two_spanStr='<span class="left-span">时长 :</span>'+
								'<span class="info-span">'+data.dtime +'分钟</span>';
			    }else if(data.assessment_status==1){//考核开始
				    tagStr='';
					if(data.exam_status==-1){//未参加考试
					   two_spanStr='<span class="left-span">时长 :</span>'+
								'<span class="info-span">'+data.dtime +'分钟</span>';
					}else{//已参加考试
					  two_spanStr='<span class="left-span">考试得分 :</span>'+
								'<span class="info-span">'+data.fenshu +'分</span>';
					}   
				}else{//结束
				   tagStr='<p class="course-type-tag">'+'已结束'+'</p>';
				   if(data.exam_status==-1){//未参加考试
					   two_spanStr='<span class="left-span">时长 :</span>'+
								'<span class="info-span">'+data.dtime +'分钟</span>';
					}else{//已参加考试
					  two_spanStr='<span class="left-span">考试得分 :</span>'+
								'<span class="info-span">'+data.fenshu +'分</span>';
					}   
				}
				
				
				var htmls = 	'<li class="mui-table-view-cell mui-media" onclick="openwin(' + DataArr + ')">'+
									'<a href="javascript:;">'+
									tagStr+
									' <img class="mui-media-object mui-pull-left course-img" src="'+isNullImgUrl(data.thum)+'"/>'+
									'<div class="mui-media-body top-content">'+
										'<p class="course_title">'+noTwenty(data.ename)+'</p>'+
									'</div>'+
									'<div class="mui-media-body ">'+
										'<p class="mui-ellipsis subtitle">'+
											'<span class="left-span">时间 :</span>'+
											'<span class="info-span">'+timeStr+'</span>'+
										'</p>'+
									'</div>'+
									'<div class="mui-media-body top_10">'+
										'<p class="mui-ellipsis subtitle">'+
											two_spanStr+
										'</p>'+
									'</div>  </a>'+
								'</li>';
				htmlsdata = htmlsdata + htmls;
			}
			if (page == 1) {
				$('#list_day').html(htmlsdata);
			} else {
				$('#list_day').append(htmlsdata);
			}
		}
		//打开考试页
		/*
		 
		 * exam_frequency 学生考试次数
		 * e_big_exam 试卷可以考试次数 0 为无数次
		 * exam_status 未考试-1 通过考试1,未通过考试0
		 * */
		function openwin(data) {
			var param = {
				sourceurl : window.location.pathname,
				sourcetitle : document.title,
				appkey : 148745497845,
				exam_id : data.enumber,
				internship_id : data.gwid,
				exam_status : data.exam_status,
				id:data.id
			}
			if (data.assessment_status == 1 && data.exam_status == -1) {//考试时间正在进行中,未考试
				api.openWin({useWKWebView:true,
					name : 'Practice_StudentExam',
					url : 'Practice_StudentExam.html',
					pageParam : param,
					slidBackEnabled : false,
					reload : true
				});
			} else if (data.assessment_status == 1 && data.exam_status == 1) {//考试时间正在进行中,通过考试
				ShowToast('您已经提交过考试');
			} else if (data.assessment_status == 1 && data.exam_status == 0) {//考试时间正在进行中,未通过考试
				if (data.e_big_exam == 0) {//无限次
					api.openWin({useWKWebView:true,
						name : 'Practice_StudentExam',
						url : 'Practice_StudentExam.html',
						pageParam : param,
						slidBackEnabled : false,
						reload : true
					});
				} else {//有限次
					if (data.exam_frequency < data.e_big_exam) {//还有考试次数
						api.openWin({useWKWebView:true,
							name : 'Practice_StudentExam',
							url : 'Practice_StudentExam.html',
							pageParam : param,
							slidBackEnabled : false,
							reload : true
						});
					} else {//没有考试次数
						ShowToast('您已经提交过考试');
					}
				}
				//					ShowToast('您已经提交过考试');
			} else if (data.assessment_status == 0) {//考试时间未开始
				ShowToast('考试时间未开始,请耐心等待');
			} else if (data.assessment_status == -1) {//考试时间已结束
				ShowToast('考试时间已结束')
			}else{
			    ShowToast('考试时间已结束')
			}	
		  
		}
		function noTwenty(b) {
			var str = b;
			if (!isEmpty(str)) {
				if (str.length > 21) {
					b = str.substr(0, 20) + '.....';
					return b
				} else {
					return b
				}
			} else {
				return '无'
			}
		}
	</script>
</html>